package com.xh.bussiness.permission.controller;

import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.xh.bussiness.permission.model.User;
import com.xh.bussiness.permission.util.UserAuthUtil;
import com.xh.core.annotation.ExcludeLoginTokenIntercept;
import com.xh.core.bean.AjaxResult;
import com.xh.core.constant.AjaxResultConstant;
import com.xh.core.controller.BaseController;
import com.xh.core.util.CacheUtils;
import com.xh.core.util.StringUtils;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/*
 * @Author daiwei
 * @Description
 * @Date 2018/9/18 17:20
 **/
@Api(tags="认证接口")
@RestController
@RequestMapping("/cache")
public class CacheTestController extends BaseController {

    @Autowired
    private CacheUtils cacheUtils;

    @GetMapping("/testSet")
    @ExcludeLoginTokenIntercept
    public AjaxResult testSet(String key,String value) {
    	cacheUtils.set(key, value);
        return new AjaxResult(AjaxResultConstant.Result.SUCCESS);
    }
    @GetMapping("/testGet")
    @ExcludeLoginTokenIntercept
    public AjaxResult testGet(String key) {
        return new AjaxResult(AjaxResultConstant.Result.SUCCESS,cacheUtils.get(key));
    }
    
}
